package com.ibigcat.module.mdm.dao.mapper;

import java.util.*;

import com.ibigcat.framework.common.pojo.PageResult;
import com.ibigcat.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.ibigcat.framework.mybatis.core.mapper.BaseMapperX;
import com.ibigcat.module.mdm.dao.entity.SupplierDO;
import org.apache.ibatis.annotations.Mapper;
import com.ibigcat.module.mdm.controller.admin.supplier.vo.*;

/**
 * 第三方信息 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface SupplierMapper extends BaseMapperX<SupplierDO> {

    default PageResult<SupplierDO> selectPage(SupplierPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<SupplierDO>()
                .eqIfPresent(SupplierDO::getSupplierCode, reqVO.getSupplierCode())
                .likeIfPresent(SupplierDO::getSupplierName, reqVO.getSupplierName())
                .eqIfPresent(SupplierDO::getAbbreviation, reqVO.getAbbreviation())
                .eqIfPresent(SupplierDO::getContactPerson, reqVO.getContactPerson())
                .eqIfPresent(SupplierDO::getContactPersonPhone, reqVO.getContactPersonPhone())
                .eqIfPresent(SupplierDO::getMail, reqVO.getMail())
                .eqIfPresent(SupplierDO::getMainNature, reqVO.getMainNature())
                .eqIfPresent(SupplierDO::getSupplierType, reqVO.getSupplierType())
                .eqIfPresent(SupplierDO::getIndustryType, reqVO.getIndustryType())
                .eqIfPresent(SupplierDO::getLogisticsAttr, reqVO.getLogisticsAttr())
                .eqIfPresent(SupplierDO::getTaxpayerType, reqVO.getTaxpayerType())
                .eqIfPresent(SupplierDO::getTaxpayerCode, reqVO.getTaxpayerCode())
                .likeIfPresent(SupplierDO::getAccountBankName, reqVO.getAccountBankName())
                .eqIfPresent(SupplierDO::getAccountCode, reqVO.getAccountCode())
                .eqIfPresent(SupplierDO::getProvince, reqVO.getProvince())
                .eqIfPresent(SupplierDO::getCity, reqVO.getCity())
                .eqIfPresent(SupplierDO::getRegion, reqVO.getRegion())
                .eqIfPresent(SupplierDO::getServiceArea, reqVO.getServiceArea())
                .eqIfPresent(SupplierDO::getServiceCategory, reqVO.getServiceCategory())
                .eqIfPresent(SupplierDO::getDisabled, reqVO.getDisabled())
                .betweenIfPresent(SupplierDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(SupplierDO::getId));
    }

}